#include <stdio.h>  
#include <unistd.h>  
#include <stdlib.h>  
#include <string.h>  
#include <fcntl.h>  
#include <sys/types.h>  
#include <sys/stat.h>  
#include <linux/ioctl.h>  
#include <signal.h>  
#include <sys/select.h>
  
int main(int argc ,char *argv[])  
{  
	int fd;  
	int len,cnt;
	char buf[50];
	char txaddress[6]={0x27,0x10,0x00,0x01,0xf0};
	char rxaddress[6]={0x27,0x10,0x00,0x01,0x01};

	fd = open("/dev/nrf24l01",O_RDWR);  
	if(fd < 0)  
	{         
	    	perror("open 24l01 device");  
		return 0;  
	}  
	ioctl(fd,1,30); 
	ioctl(fd,3,&txaddress);
	ioctl(fd,4,&rxaddress);
	while(1)  
	{  
		len = read(fd, buf, 32);
		if(len > 0)
		{
			printf("%s\n",buf);
		}
		usleep(100);
	}  
	close(fd);                                                         
	return 0;  
}  
